<HTML>
<HEAD>
<TITLE>/usr/local/src/sqlrelay-0.25/doc/api/ruby/rubydbi.html</TITLE>
</HEAD>
<BODY BGcolor=#FFFFFF TEXT=#000000>
<PRE>
<FONT color=#0000f8># Copyright (c) 2001 David Muse</FONT>
<FONT color=#0000f8># See the file COPYING for more information</FONT>


<B><FONT color=#a02828>class</FONT></B> <FONT color=#008888>Driver</FONT>

    <FONT color=#008888>connect</FONT>(dbname, user, auth, attr)
<FONT color=#f800f8>        dbname should have the format: </FONT>
<FONT color=#f800f8>        "DBI:SQLRelay:host=host;port=port;socket=socket;"</FONT>

<FONT color=#f800f8>        Opens a connection to the sqlrelay server and </FONT>
<FONT color=#f800f8>        authenticates with user and auth.  attr is</FONT>
<FONT color=#f800f8>        currently ignored.</FONT>


<B><FONT color=#a02828>class</FONT></B> <FONT color=#008888>Database</FONT>
        
    <FONT color=#008888>disconnect</FONT>()
<FONT color=#f800f8>        Ends the current session.</FONT>

    <FONT color=#008888>prepareQuery</FONT>(query)
<FONT color=#f800f8>        Prepare to execute query.  Returns a Statement.</FONT>

    <FONT color=#008888>ping</FONT>()
<FONT color=#f800f8>        Returns true if the database is up and false</FONT>
<FONT color=#f800f8>        if it's down.</FONT>

    <FONT color=#008888>commit</FONT>()
<FONT color=#f800f8>        Issues a commit.</FONT>
<FONT color=#f800f8>        Raises a DBI::ProgrammingError if it failed.</FONT>

    <FONT color=#008888>rollback</FONT>()
<FONT color=#f800f8>        Issues a rollback.</FONT>
<FONT color=#f800f8>        Raises a DBI::ProgrammingError if it failed.</FONT>

    <FONT color=#008888>[]</FONT>=(attr,value)
<FONT color=#f800f8>        Stores "value" associated with key "attr".</FONT>
<FONT color=#f800f8>        sqlrelay_debug=true/false will toggle</FONT>
<FONT color=#f800f8>        debugging and AutoCommit=true/false will</FONT>
<FONT color=#f800f8>        toggle autocommit.</FONT>


<B><FONT color=#a02828>class</FONT></B> <FONT color=#008888>Statement</FONT>

    <FONT color=#008888>bind_param</FONT>(param, value, attribs)
<FONT color=#f800f8>        Binds value to param defined earlier in the</FONT>
<FONT color=#f800f8>        prepare call.  attribs is currently unused.</FONT>

    <FONT color=#008888>execute</FONT>()
<FONT color=#f800f8>        Send a SQL query to the server and</FONT>
<FONT color=#f800f8>        returns the number of rows returned.</FONT>
<FONT color=#f800f8>        Raises a DBI::ProgrammingError if it failed.</FONT>

    <FONT color=#008888>finish</FONT>()
<FONT color=#f800f8>        Invalidates the statement.</FONT>

    <FONT color=#008888>fetch</FONT>()
<FONT color=#f800f8>        Returns one row of the result set.</FONT>

    <FONT color=#008888>column_info</FONT>()
<FONT color=#f800f8>        Returns an array of hashes.</FONT>
<FONT color=#f800f8>        Each hash contains a 'name', 'type_name'</FONT>
<FONT color=#f800f8>        and 'precision' key.</FONT>

    <FONT color=#008888>rows</FONT>()
<FONT color=#f800f8>        Returns the number of rows in the current result set.</FONT>

    <FONT color=#008888>fetch_scroll</FONT>(direction, offset=1)
<FONT color=#f800f8>        Returns one row of the result set.</FONT>
<FONT color=#f800f8>        Which row depends on direction and offset.</FONT>
<FONT color=#f800f8>        For DBI::SQL_FETCH_NEXT the next row is returned.</FONT>
<FONT color=#f800f8>        For DBI::SQL_FETCH_PRIOR the prior row is returned.</FONT>
<FONT color=#f800f8>        For DBI::SQL_FETCH_FIRST the first row is returned.</FONT>
<FONT color=#f800f8>        For DBI::SQL_FETCH_LAST the last row is returned.</FONT>
<FONT color=#f800f8>        For DBI::SQL_FETCH_ABSOLUTE the "offset" row is returned.</FONT>
<FONT color=#f800f8>        For DBI::SQL_FETCH_RELATIVE the row "offset" </FONT>
<FONT color=#f800f8>              rows from the current row is returned.</FONT>

    <FONT color=#008888>fetch_many</FONT>(cnt)
<FONT color=#f800f8>        Returns the next "cnt" rows rest of the result set.</FONT>

    <FONT color=#008888>fetch_all</FONT>()
<FONT color=#f800f8>        Returns the rest of the result set.</FONT>

</PRE>
</BODY>
</HTML>
